package com.miyake.dsp.osa.lab.wrapper;

import com.miyake.dsp.common.CommonTool;
import com.miyake.dsp.osa.lab.Calculator;
import com.miyake.dsp.osa.lab.LimiterSetting2;

public class LimiterWrapper extends Calculator {
	private static final String INPUT = "Input";
	private static final String OUTPUT = "Output";
	private LimiterSetting2 setting;
	
	public LimiterWrapper(LimiterSetting2 setting) {
		initInput(INPUT);
		initOutput(OUTPUT);
		this.setting = setting;
	}
	
	@Override
	public synchronized void process() {
		double[] in = this.getInput(INPUT).getRealPart();
		double[] out = CommonTool.getLimited(in, setting.getCeiling());
		this.setOutput(OUTPUT, out);
	}

	@Override
	public Object getSetting() {
		return this.setting;
	}

}
